unit FormInformaAguardarUnit;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;

type
  TFormInformaAguardar = class(TForm)
    me: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    MemoJus: TMemo;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    tevejustificativa : boolean;
    idos : Integer;
  end;

var
  FormInformaAguardar: TFormInformaAguardar;

implementation

{$R *.dfm}

uses DMDadosUnt;

procedure TFormInformaAguardar.BitBtn1Click(Sender: TObject);
begin
  tevejustificativa := false;
  close;
end;

procedure TFormInformaAguardar.BitBtn2Click(Sender: TObject);
begin
  if MemoJus.Text = '' then
    MessageDlg('Informe uma justificativa.',mtConfirmation,[mbOK],0);


  if MemoJus.Text <> '' then
  begin
    tevejustificativa := true;

    DMDados.cdsHistorico.Open;
    DMDados.cdsHistorico.Edit;
    DMDados.cdsHistorico.Append;

    DMDados.cdsHistoricoID_OS.AsInteger := idos;
    DMDados.cdsHistoricoHISTORICO.AsString := MemoJus.Text;
    DMDados.cdsHistoricoTIPO.AsString := 'ADIADO';
    DMDados.cdsHistoricoDATA.AsDateTime := Now;

    DMDados.cdsHistorico.Post;

    DMDados.cdsHistorico.ApplyUpdates(-1);

    close;
  end;

end;

procedure TFormInformaAguardar.FormShow(Sender: TObject);
begin
MemoJus.Text := '';
end;

end.
